/*    */ package net.sourceforge.appgen.converter;
/*    */ 
/*    */ public class CamelCaseConverter
/*    */   implements StringConverter
/*    */ {
/*    */   public static final char UNDERBAR = '_';
/*    */ 
/*    */   public String convert(String origin)
/*    */   {
/* 27 */     return convert(origin, true);
/*    */   }
/*    */ 
/*    */   public String convert(String origin, boolean toLowerCase) {
/* 31 */     if ((origin == null) || (origin.length() == 0)) {
/* 32 */       return origin;
/*    */     }
/*    */ 
/* 35 */     StringBuffer buf = null;
/*    */ 
/* 37 */     if (toLowerCase)
/* 38 */       buf = new StringBuffer(origin.toLowerCase());
/*    */     else {
/* 40 */       buf = new StringBuffer(origin);
/*    */     }
/*    */ 
/* 43 */     int index = 0;
/* 44 */     while (index < buf.length()) {
/* 45 */       if (buf.charAt(index) == '_') {
/* 46 */         if (index + 1 < buf.length()) {
/* 47 */           buf.setCharAt(index + 1, Character.toUpperCase(buf.charAt(index + 1)));
/*    */         }
/*    */ 
/* 50 */         buf.deleteCharAt(index);
/*    */       }
/*    */ 
/* 53 */       index++;
/*    */     }
/*    */ 
/* 56 */     String result = buf.toString();
/*    */ 
/* 58 */     if (result.indexOf('_') >= 0) {
/* 59 */       return convert(result, false);
/*    */     }
/*    */ 
/* 62 */     return result;
/*    */   }
/*    */ }

/* Location:           C:\Users\lzl6066\Downloads\net.sourceforge.appgen_1.2.0\plugins\net.sourceforge.appgen_1.2.0.201002031718\
 * Qualified Name:     net.sourceforge.appgen.converter.CamelCaseConverter
 * JD-Core Version:    0.6.0
 */